<style>
    /**
     * 表格排序
     */
    .list-table-sort {

    }

    .list-table-sort th {
        cursor: pointer;
    }

    .list-table-sort th:after {
        content: '';
        display: block;
        float: right;
        width: 16px;
        height: 16px;
        background-image: url(/images/icon/list-table-sort.png);
        background-repeat: no-repeat;
        background-position: 50% 1px;
    }

    .list-table-sort th.no-sort {
        cursor: default;
    }

    .list-table-sort th.no-sort:after {
        background: none;
    }

    .list-table-sort th.sorted.ascending:after {
        background-position: 50% -15px;
    }

    .list-table-sort th.sorted.descending:after {
        background-position: 50% -31px;
    }
</style>
{load_js file="jquery/jquery.tablesort.js"}
<script>
    (function () {
        var table = $('.list-table');
        table.tablesort();
        var tablesort = table.data('tablesort');

        table.find('thead th[data-sort-type]').each(function () {
            var el = $(this);
            switch (el.data('sort-type')) {
                case 'int':
                    console.log('int');
                    el.data('sortBy', function (th, td, tablesort) {
                        return parseInt(td.text());
                    });
                    break;
                case 'float':
                    el.data('sortBy', function (th, td, tablesort) {
                        return parseFloat(td.text());
                    });
                    break;
            }
        });
    })();
</script>